class Cat:
    def __init__(self, name):
        self.name = name

    def __del__(self):
        print("%s去了" % self.name)

    # 相当于java的toString方法
    def __str__(self):
        return "猫对象 %s" % self.name

    def eat(self):
        print("%s吃鱼" % self.name)


tom = Cat("tom")
tom.eat()
print("--" * 25)
print(tom)
